<?php
  //Bust cache in the head
  header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

  //always modified
  header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  header ("Pragma: no-cache"); // HTTP/1.0 
?>
<?php echo(doctype('xhtml1-trans'))?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title><?php echo $Title;?></title>
	<link rel="icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />
	<link rel="shortcut icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />	
    <?php echo meta('title', $mTitle);?>
    <?php echo meta('description', $mDesc);?>
    <?php echo meta('keywords', $mKey);?>
    <?php echo meta('language', 'th');?>
    <?php echo meta('robots', 'index,follow');?>
    <?php echo(meta(array('name'=>'Content-type','content'=>'text/html;charset=UTF-8','type'=>'equiv')))?>
	<script type="text/javascript">
	 	/*Set Web Path*/
		var web_path = '<?php echo base_url();?>';
	</script>
	
    <!--Load Js-->
    <?php 
    if(!empty($js)):
            foreach($js as $value):
                    if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/js/'.$value)) && !empty($value)):
                            echo js_asset($value)."\n";				
                    endif;
            endforeach;
    endif;
    ?>
    <!--Load Css-->
    <?php 
    if(!empty($css)):
            foreach($css as $value):
                    if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/css/'.$value)) && !empty($value)):
                            echo css_asset($value,'', array('media'=>'all'))."\n";			
                    endif;
            endforeach;
    endif;
    ?>
    <!--Load External Js-->
    <?php
    if(!empty($external_js)):
	?>
	<script type="text/javascript" language="javascript">
    	<?php echo $external_js;?>
	</script>
	<?php
    endif;
    ?>
    <!--Load External Css-->
    <?php
    if(!empty($external_css)):
	?>
	<style type="text/css">
    	<?php echo $external_css;?>
	</style>
	<?php
    endif;
    ?>
	<script type='text/javascript'>
	/* <![CDATA[ */		
	  	userSettings = {
	        url: "",
	        uid: "<?php echo md5(current_url());?>",
	        time: ""
	    }
		/*userSettings = '';*/	
	/* ]]> */
	</script>
	<!--External Connection (30 minutes time out)-->
	<?php if(isset($external_connection) && $external_connection):?>
	<script type='text/javascript'>
		var external_connection_timeout = Number('<?php echo $external_connection_timeout;?>');
		setTimeout(function(){
			$.ajax({
				type:'post',
				url: web_path+'logout'
			}).done(function(){
				window.location.href = window.location.href; 
			});
		},external_connection_timeout )
	</script>
	<?php endif;?>	
</head>
<body class="wp-administrator">
    <div id="wpwrap">
        <div id="wpcontent">
            <!-- HEAD -->
            <div id="wphead">
                <h1 ><a href="<?php echo base_url('administrator');?>" title="Content Management System">Content Management System</a></h1>
                <div id="wphead-info">
                    <div id="user_info">
                        <p><span id="loading"></span>&nbsp;&nbsp;Hello,&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $this->session->userdata('username')?> | <?php echo anchor(base_url().'logout','logout',array('title'=>'logout'))?></p>
                    </div>
                </div>
            </div>
            <!-- END HEAD -->
            <div id="wpbody">
                <!-- MENU -->
				<?php echo $this->administrator_model->box_left_menu();?>
                <!-- END MENU -->
                <!-- BODY -->
                <?php $this->load->view($content)?>
                <!-- END BODY -->
            </div>
        </div>
    </div>

<div id="footer">
    <p id="footer-upgrade" class="alignright">&copy; Copyright 2013 <a href="http://www.you2play.com" target="_blank">You2play.com</a></p>
    <div class="clear"></div>
</div>

<div id="closebutton" class="highslide-overlay closebutton" onclick="return hs.close(this)" title="Close"></div>

</body>
</html>